import requests


class EmpMangerApi(object):
    def add_emp(self, req_head, req_data):
        resp = requests.post(url="http://ihrm2-test.itheima.net/api/sys/user/",
                             headers=req_head,
                             json=req_data)
        return resp

    def query_emp(self, req_head, emp_id):
        resp = requests.get(url="http://ihrm2-test.itheima.net/api/sys/user/" + emp_id,
                            headers=req_head)
        return resp

    def modify_emp(self, req_head, req_data, emp_id):
        resp = requests.put(url="http://ihrm2-test.itheima.net/api/sys/user/" + emp_id,
                            headers=req_head,
                            json=req_data)
        return resp

    def delete_emp(self, req_head, emp_id):
        resp = requests.delete(url="http://ihrm2-test.itheima.net/api/sys/user/" + emp_id,
                               headers=req_head,
                               )
        return resp


if __name__ == '__main__':
    emp = EmpMangerApi()
    req_head = {"Authorization": "a235cc97-9c11-4539-bc5f-c27101eb8b21"}
    # req_data={
    #     "username":"高启强",
    #     "mobile":"13022991103",
    #     "workNumber":" 2389237489022001"
    # }
    # resp=emp.add_emp(req_head,req_data)
    # print(resp.json())
    emp_id = "1630456601905213440"
    # req_data = {"username": "安欣"}
    resp = emp.delete_emp(req_head,  emp_id)
    print(resp.json())
